﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Wicresoft.SMS.Data;

namespace Wicresoft.SMS.Web
{
    public class CommonController : CustomBaseController
    {

        private ICommonService _commonservice;
        private IUserRoleService _userservice;

        public CommonController(ICommonService cservice , IUserRoleService uservice)
        {
            _commonservice = cservice;
            _userservice = uservice;
        }

        //
        // GET: /Common/
        [ChildActionOnly]
        public ViewResult Menu()
        {
            CommonMenuModel model = new CommonMenuModel();
            model.UserName = User.Identity.Name;
            model.LoadDepartments(_commonservice.GetDepartments());
            ViewData.Model = model;
            return View();
        }

        [ChildActionOnly]
        public ViewResult UserBanner()
        {
            CommonUseBannerModel model = new CommonUseBannerModel(
                _userservice.GetUserInfo(User.Identity.Name));
            model.UserName = model.UserAilas;
            ViewData.Model = model;
            return View();
        }

    }
}
